package cn.dfun.demo.scdemo.ali.seata.controller;

import cn.dfun.demo.scdemo.ali.seata.service.StorageService;
import cn.dfun.demo.scdemo.common.entity.CommonResult;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
public class StorageController {
    @Resource
    private StorageService storageService;

    @PostMapping("/storage/decrease")
    public CommonResult decrease(@RequestParam Long productId, @RequestParam Integer count) {
        storageService.decrease(productId, count);
        return CommonResult.success();
    }
}
